﻿
/*
 * Copyright (C) Han Wei
 */


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BSvr.Model
{
    /// <summary>
    /// 错误类
    /// </summary>
    public class Error
    {
        /*
         * 0开头的是服务器错误，其他的是用户自定义错误。
         * 
         */
        public const string NO_BUS              = "00001";       // 没有该业务
        public const string UN_RUNNING          = "00002";       // 业务未执行或未加载
        public const string EXCEPTION           = "00003";       // 异常

        /// <summary>
        /// 序列化错误消息
        /// </summary>
        /// <param name="errcode">错误编码</param>
        /// <param name="errmsg">错误消息</param>
        /// <returns></returns>
        public static string Serialize(string errcode, string errmsg) {
            return string.Format("<?xml version=\"1.0\"?><error><code>{0}</code><content>{1}</content></error>", errcode, errmsg);
        }
    }
}
